#pragma once

#include <QWidget>

class QWebEngineView;
class QLiteHtmlBrowser;

namespace Ui {
class LookupWidget;
}

class LookupWidget : public QWidget {
    Q_OBJECT

public:
    explicit LookupWidget(QWidget *parent = nullptr);
    ~LookupWidget();
    void setContent(const QString &html);

protected:
#if (QT_VERSION <= QT_VERSION_CHECK(6, 0, 0))
    void enterEvent(QEvent *e) override;
#else
    void enterEvent(QEnterEvent *) override;
#endif
    void leaveEvent(QEvent *e) override;

public slots:
    void moveAndExplain(QString msg, int type, QPoint pos);

private:
    Ui::LookupWidget *ui;
#ifdef HasWebEngine
    QTextBrowser* m_view;
#else
    QLiteHtmlBrowser *m_view;
#endif
    QTimer *m_hideTimer;

    // QObject interface
public:
    virtual bool event(QEvent *event) override;
};
